package com.songcy.dao;

import java.util.List;

import com.dao.ObjectDao;
import com.pro.bean.Card_View;
import com.pro.bean.Info;

public class CardDao extends ObjectDao {
	String sql = null;
	public List findCards(String cmp,String cardname
			,String user,String timetype,String dates,String datee)
	{
		sql = "select * from card_view where 1=1";
		if(user==null ||user.length() == 0 || user.equals("all"))
			;
		else
			sql += " and username='"+user+"'";
		if(cmp.length() != 0)
			sql += " and cmp='"+cmp+"'";
		if(cardname.length() != 0)
			sql +=" and firstname like '"+cardname+"'";
		if(dates.length() != 0)
		{
			if(timetype.equals("更新日"))//1 update time 2 updatetime 
				sql += " and uptime between '"+dates+"' and '"+datee+"'";
			if(timetype.equals("登陆日"))
				sql +=" and lastlogtime between '"+dates+"' and '"+ datee+"'";
		}
		System.out.println(sql);
		return super.findAll(sql, new Card_View());
	}
	
	public String SQL(){
		return sql;
	}
	
}
